class CreateDepartments < ActiveRecord::Migration
  def self.up
    create_table :departments do |t|
      t.string :name                ,:limit => 20
      t.integer :manager_id         ,:limit => 2
      t.string :area                ,:limit => 30
      t.integer :is_locked ,:limit => 1 ,:default => 0 #是否管理会要锁定 1为True 0为False
      t.timestamps
    end
    
    Department.create(:name => '国内')
    Department.create(:name => '客服')
    Department.create(:name => '国际')
    Department.create(:name => '李沧区',:area=>'李沧')
    Department.create(:name => '四方区',:area=>'四方')
    Department.create(:name => '崂山区',:area=>'崂山')
    Department.create(:name => '黄岛区',:area=>'黄岛')
    Department.create(:name => '城阳区',:area=>'城阳')
    Department.create(:name => '财务')
    Department.create(:name => '市场部')
    Department.create(:name => '办公室')
  end

  def self.down
    drop_table :departments
  end
end
